package cc.rengu.redp.system.domain;

import cc.rengu.redp.common.converter.CustomConverter;
import cc.rengu.redp.common.converter.ExcelCustomConvert;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;

@Data
@ExcelIgnoreUnannotated
@TableName("T_MENU")
public class Menu implements Serializable {

    private static final long serialVersionUID = 7187628714679791771L;

    public static final String TYPE_MENU = "0";

    public static final String TYPE_BUTTON = "1";

    @TableId(value = "MENU_ID")
    private Long menuId;

    private Long parentId;

    @NotBlank(message = "{required}")
    @Size(max = 10, message = "{noMoreThan}")
    @ExcelProperty(value = "名称")
    private String menuName;

    @Size(max = 50, message = "{noMoreThan}")
    @ExcelProperty(value = "地址")
    private String path;

    @Size(max = 100, message = "{noMoreThan}")
    @ExcelProperty(value = "对应Vue组件")
    private String component;

    @Size(max = 50, message = "{noMoreThan}")
    @ExcelProperty(value = "权限")
    private String perms;

    @ExcelProperty(value = "图标")
    private String icon;

    @NotBlank(message = "{required}")
    @ExcelProperty(value = "类型", converter = CustomConverter.class)
    @ExcelCustomConvert(value = {"0", "1"}, label = {"按钮", "菜单"})
    private String type;

    private Double orderNum;

    @ExcelProperty(value = "创建时间")
    private Date createTime;

    @ExcelProperty(value = "修改时间")
    private Date modifyTime;

    @TableField(exist = false)
    private String createTimeFrom;

    @TableField(exist = false)
    private String createTimeTo;

}